package org.oslims.client.uicomponents.editbox;

import org.oslims.domain.AbstractSample;
import org.oslims.domain.AnalysisResult;

import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

public class ShowPlaningBox {

	final DialogBox dialogBox = new DialogBox(true, true);
	final VerticalPanel boxPanel = new VerticalPanel();

	final CellTable<AnalysisResult> table = new CellTable<AnalysisResult>();
	final Label sampleLabel = new Label();
	final HorizontalPanel buttonLine = new HorizontalPanel();
	final Button okButton = new Button("OK");

	public ShowPlaningBox() {

		dialogBox.setText("View Planing");

		boxPanel.add(sampleLabel);
		boxPanel.add(table);

		buttonLine.add(okButton);
		boxPanel.add(buttonLine);

		dialogBox.add(boxPanel);
	}

	public CellTable<AnalysisResult> getTable() {
		return table;
	}

	public void show(AbstractSample s) {
		sampleLabel.setText("Show Planing for Sample: " + s.getCode());
		dialogBox.center();
	}

	public HasClickHandlers getOKButton() {
		return okButton;
	}

	public void hide() {
		dialogBox.hide();
	}
}
